<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="85px">
      <el-form-item label="报修人姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入报修人姓名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="工号" prop="jobId">
        <el-input
          v-model="queryParams.jobId"
          placeholder="请输入工号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="联系电话" prop="phone">
        <el-input
          v-model="queryParams.phone"
          placeholder="请输入联系电话"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <br>
      <el-form-item label="维修员姓名" prop="serviceName">
        <el-input
          v-model="queryParams.serviceName"
          placeholder="请输入维修员姓名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="报修地址" prop="location">
        <el-input
          v-model="queryParams.location"
          placeholder="请输入报修地址"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="紧急程度" prop="emergency">
        <el-select v-model="queryParams.emergency" placeholder="请选择紧急程度" clearable size="small">
          <el-option
            v-for="dict in emergencyOptions"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <br>
      <el-form-item label="处理状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择处理状态" clearable size="small">
          <el-option
            v-for="dict in statusOptions"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="创建时间">
        <el-date-picker v-model="dateRange"
                        size="small"
                        style="width: 240px"
                        value-format="yyyy-MM-dd"
                        type="daterange"
                        range-separator="-"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <!--<el-form-item label="受理时间" prop="assignTime">
        <el-date-picker clearable size="small" style="width: 240px"
                        v-model="queryParams.assignTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择受理时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="解决时间" prop="resolveTime">
        <el-date-picker clearable size="small" style="width: 240px"
                        v-model="queryParams.resolveTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择解决时间">
        </el-date-picker>
      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPerm="['repair_add']"
        >新增
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleEdit"
          v-hasPerm="['repair_edit']"
        >修改
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDel"
          v-hasPerm="['repair_del']"
        >删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPerm="['repair_export']"
        >导出
        </el-button>
      </el-col>
      <div class="top-right-btn">
        <el-tooltip class="item" effect="dark" content="刷新" placement="top">
          <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery"/>
        </el-tooltip>
        <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top">
          <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch"/>
        </el-tooltip>
      </div>
    </el-row>

    <el-table v-loading="loading" :data="repairList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="序号" type="index" align="center" show-overflow-tooltip width="50px"/>
<!--      <el-table-column label="id" align="center" prop="id"/>-->
      <el-table-column label="姓名" align="center" prop="name"/>
      <el-table-column label="工号" align="center" prop="jobId"/>
      <el-table-column label="联系电话" align="center" prop="phone"/>
      <el-table-column label="报修地址" align="center" prop="location"/>
      <el-table-column label="问题描述" align="center" prop="problemInfo"/>
      <el-table-column label="紧急程度" align="center" prop="emergency" :formatter="emergencyFormat"/>
      <!--<el-table-column label="受理时间" align="center" prop="assignTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.assignTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="受理时长" align="center" prop="assignDuration"/>
      <el-table-column label="解决时间" align="center" prop="resolveTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.resolveTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="解决时长" align="center" prop="resolveDuration"/>-->
      <el-table-column label="处理状态" align="center" prop="status" :formatter="statusFormat"/>
      <el-table-column label="创建人" align="center" prop="createBy"/>
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view "
            @click="handleDetail(scope.row)"
          >详情
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleEdit(scope.row)"
            v-hasPerm="['repair_edit']"
            v-show="scope.row.status === 'WAIT_ASSIGN'"
          >修改
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDel(scope.row)"
            v-hasPerm="['repair_del']"
            v-show="scope.row.status === 'WAIT_ASSIGN'"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.current"
      :limit.sync="queryParams.size"
      @pagination="getList"
    />

    <!-- 报修单详情对话框 -->
    <el-dialog :title="title" :visible.sync="openDetail" width="680px">
      <el-form ref="form" :model="form" label-width="85px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓名" prop="name">
              <el-input v-model="form.name" readonly="readonly"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="工号" prop="jobId">
              <el-input v-model="form.jobId" readonly="readonly"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联系电话" prop="phone">
              <el-input v-model="form.phone" readonly="readonly"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="紧急程度" prop="emergency">
              <el-select disabled v-model="form.emergency" placeholder="请选择紧急程度">
                <el-option
                  v-for="dict in emergencyOptions"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="创建时间" prop="createTime">
              <el-date-picker readonly="readonly"
                              clearable size="small" style="width: 240px"
                              v-model="form.createTime"
                              type="string"
                              value-format="yyyy-MM-dd hh:mm:ss">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="状态">
              <el-select disabled v-model="form.status">
                <el-option
                  v-for="dict in statusOptions"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-show="form.serviceName !== null">
            <el-form-item label="维修员" prop="serviceName">
              <el-input v-model="form.serviceName" readonly="readonly"/>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-show="form.servicePhone !== null">
            <el-form-item label="维修电话" prop="servicePhone">
              <el-input v-model="form.servicePhone" readonly="readonly"/>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="报修地址" prop="location">
              <el-input v-model="form.location" readonly="readonly"/>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="问题描述" prop="problemInfo">
              <el-input v-model="form.problemInfo" type="textarea" readonly="readonly"/>
            </el-form-item>
          </el-col>
          <div v-if="form.assignTime !== null">
            <el-col :span="12">
              <el-form-item label="受理时间" prop="assignTime">
                <el-date-picker clearable size="small" style="width: 240px"
                                readonly="readonly"
                                v-model="form.assignTime"
                                type="String"
                                value-format="yyyy-MM-dd"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="受理时长" prop="assignDuration">
                <el-input v-model="form.assignDuration"/>
              </el-form-item>
            </el-col>
          </div>
          <div v-if="form.resolveTime !== null">
            <el-col :span="12">
              <el-form-item label="解决时间" prop="resolveTime">
                <el-date-picker clearable size="small" style="width: 240px"
                                readonly="readonly"
                                v-model="form.resolveTime"
                                type="String"
                                value-format="yyyy-MM-dd"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="解决时长" prop="resolveDuration">
                <el-input v-model="form.resolveDuration"/>
              </el-form-item>
            </el-col>
          </div>
          <el-col :span="24">
            <el-form-item label="解决回复" prop="reply" v-if="form.reply !== null">
              <el-input v-model="form.reply" type="textarea" readonly="readonly"/>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="评价" prop="comment" v-if="form.comment !== null">
              <el-input v-model="form.comment" type="textarea" readonly="readonly"/>
            </el-form-item>
          </el-col>
        </el-row>
        <div>
          <el-button
            type="primary" plain
            @click="handleAssign()"
            v-if="form.status === 'WAIT_ASSIGN'"
            v-hasPerm="['repair_assign']"
          >指 派
          </el-button>
          <el-button
            type="primary" plain
            @click="handleResolve()"
            v-if="form.status === 'PROCESSING'"
            v-hasPerm="['repair_resolved']"
          >已 解 决
          </el-button>
          <el-button
            type="primary" plain
            @click="handleComment()"
            v-if="form.status === 'RESOLVED' && form.comment === null"
            v-hasPerm="['repair_comment']"
          >评 价
          </el-button>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">关 闭</el-button>
      </div>
    </el-dialog>

    <!-- 添加或修改报修单对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="680px">
      <el-form ref="form" :model="form" :rules="rules" label-width="85px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓名" prop="name">
              <el-input v-model="form.name" placeholder="请输入报修人姓名"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="工号" prop="jobId">
              <el-input v-model="form.jobId" placeholder="请输入工号"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联系电话" prop="phone">
              <el-input v-model="form.phone" placeholder="请输入联系电话"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="紧急程度" prop="emergency">
              <el-select
                v-model="form.emergency"
                placeholder="请选择紧急程度"
              >
                <el-option
                  v-for="dict in emergencyOptions"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="报修地址" prop="location">
              <el-input v-model="form.location" placeholder="请输入报修地址"/>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="问题描述" prop="problemInfo">
              <el-input v-model="form.problemInfo" type="textarea" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
             <el-form-item label="受理时间" prop="assignTime">
               <el-date-picker clearable size="small" style="width: 240px"
                               v-model="form.assignTime"
                               type="date"
                               value-format="yyyy-MM-dd"
                               placeholder="选择受理时间">
               </el-date-picker>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="受理时长" prop="assignDuration">
               <el-input v-model="form.assignDuration" type="textarea" placeholder="请输入内容"/>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="解决时间" prop="resolveTime">
               <el-date-picker clearable size="small" style="width: 240px"
                               v-model="form.resolveTime"
                               type="date"
                               value-format="yyyy-MM-dd"
                               placeholder="选择解决时间">
               </el-date-picker>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="解决时长" prop="resolveDuration">
               <el-input v-model="form.resolveDuration" type="textarea" placeholder="请输入内容"/>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="处理状态">
               <el-select v-model="form.status" placeholder="请选择处理状态">
                 <el-option
                   v-for="dict in statusOptions"
                   :key="dict.value"
                   :label="dict.label"
                   :value="dict.value"
                 ></el-option>
               </el-select>
             </el-form-item>
           </el-col>-->
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 报修单处理操作 -->
    <el-dialog :title="titleTwo" :visible.sync="openProcessing">
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="维修员" prop="serviceId" v-if="form.status === 'WAIT_ASSIGN'">
              <el-select v-model="form.serviceId" placeholder="请选择姓名"
                         filterable
                         @input.native="filterData"
                         clearable
                         ref="searchSelect">
                <el-option
                  v-for="serviceUser in serviceUserOptions"
                  :key="serviceUser.value"
                  :label="serviceUser.nickName"
                  :value="serviceUser.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="解决回复" prop="reply" v-if="form.status === 'PROCESSING'">
              <el-input v-model="form.reply" type="textarea" placeholder="请输入解决回复"/>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="评价" prop="comment" v-if="form.status === 'RESOLVED'">
              <el-input v-model="form.comment" type="textarea" placeholder="请输入评价"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitProcessing">确 定</el-button>
        <el-button @click="cancelAssign">关 闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listRepair,
  getRepair,
  delRepair,
  addRepair,
  editRepair,
  exportRepair,
  repairAssign,
  repairComment,
  repairResolved
} from "@/api/it/repair";
import {listServiceUser} from "@/api/system/user";

export default {
  name: "Repair",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // 报修单表格数据
      repairList: [],
      // 弹出层标题(第一层)
      title: "",
      // 弹出层标题(第二层)
      titleTwo: "",
      // 是否显示弹出层(新增\修改)
      open: false,
      // 是否显示弹出层(详情)
      openDetail: false,
      // 是否显示弹出层(指派)
      openProcessing: false,
      // 日期范围
      dateRange: [],
      // 维修员列表
      serviceUserOptions: [],
      // 紧急程度字典
      emergencyOptions: [],
      // 处理状态字典
      statusOptions: [],                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // 查询参数
      queryParams: {
        current: 1,
        size: 10,
        name: undefined,
        jobId: undefined,
        phone: undefined,
        serviceName: undefined,
        location: undefined,
        problemInfo: undefined,
        emergency: undefined,
        assignTime: undefined,
        resolveTime: undefined,
        status: undefined,
        photo: undefined,
        createTime: undefined,
      },
      // 显示搜索条件
      showSearch: true,
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        id: [
          {required: true, message: "id不能为空", trigger: "blur"}
        ],
        name: [
          {required: true, message: "报修人姓名不能为空", trigger: "blur"}
        ],
        jobId: [
          {required: true, message: "工号不能为空", trigger: "blur"}
        ],
        phone: [
          {required: true, message: "联系电话不能为空", trigger: "blur"},
          {
            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
            message: "请输入正确的手机号码",
            trigger: "blur"
          }
        ],
        location: [
          {required: true, message: "报修地址不能为空", trigger: "blur"}
        ],
        problemInfo: [
          {required: true, message: "问题描述不能为空", trigger: "blur"}
        ],
        emergency: [
          {required: true, message: "紧急程度不能为空", trigger: "blur"}
        ],
        serviceId: [
          {required: true, message: "维修员不能为空", trigger: "blur"}
        ],
        reply: [
          {required: true, message: "解决回复不能为空", trigger: "blur"}
        ],
        comment: [
          {required: true, message: "评价不能为空", trigger: "blur"}
        ],
      }
    };
  },
  created() {
    this.getList();
    this.getDicts("repair_emergency").then(response => {
      this.emergencyOptions = response.data;
    });
    this.getDicts("repair_status").then(response => {
      this.statusOptions = response.data;
    });
  },
  methods: {
    filterData() {
      var str = this.$refs.searchSelect.$data.selectedLabel;// 此属性得到输入的文字
      // 控制的js
      if (str.length > 20) {
        this.$refs.searchSelect.$data.selectedLabel = str.substr(0, 21)
      }
    },
    /** 查询报修单列表 */
    getList() {
      this.loading = true;
      listRepair(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
        this.repairList = response.data;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 紧急程度字典翻译
    emergencyFormat(row, column) {
      return this.selectDictLabel(this.emergencyOptions, row.emergency);
    },
    // 处理状态字典翻译
    statusFormat(row, column) {
      return this.selectDictLabel(this.statusOptions, row.status);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.openDetail = false;
      this.reset();
    },
    // 关闭指派操作界面按钮
    cancelAssign() {
      this.openProcessing = false;
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        name: undefined,
        jobId: undefined,
        phone: undefined,
        serviceId: undefined,
        serviceName: undefined,
        servicePhone: undefined,
        location: undefined,
        problemInfo: undefined,
        comment: undefined,
        reply: undefined,
        emergency: undefined,
        assignTime: undefined,
        assignDuration: undefined,
        resolveTime: undefined,
        resolveDuration: undefined,
        status: undefined,
        photo: undefined,
        createBy: undefined,
        createTime: undefined,
        updateBy: undefined,
        updateTime: undefined,
        remarks: undefined,
        delFlag: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.current = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 指派按钮操作 */
    handleAssign() {
      listServiceUser().then(response => {
        this.serviceUserOptions = response.data;
      });
      this.openProcessing = true;
      this.titleTwo = "指派维修员";
    },
    /** 解决回复按钮操作 */
    handleResolve() {
      this.openProcessing = true;
      this.titleTwo = "解决回复";
    },
    /** 评价按钮操作 */
    handleComment() {
      this.openProcessing = true;
      this.titleTwo = "评价";
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加报修单";
    },
    /** 详情按钮操作 */
    handleDetail(row) {
      this.reset();
      const id = row.id
      getRepair(id).then(response => {
        this.form = response.data;
        this.openDetail = true;
        this.title = "报修单信息详情";
      });
    },
    /** 修改按钮操作 */
    handleEdit(row) {
      this.reset();
      const id = row.id || this.ids
      getRepair(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改报修单";
      });
    },
    /** 指派提交操作 */
    submitProcessing() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.status === "WAIT_ASSIGN") {
            repairAssign(this.form).then(response => {
              if (response.code === 0) {
                this.msgSuccess("指派成功");
                this.openProcessing = false;
                this.openDetail = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            });
          } else if (this.form.status === "PROCESSING") {
            repairResolved(this.form).then(response => {
              if (response.code === 0) {
                this.msgSuccess("回复成功");
                this.openProcessing = false;
                this.openDetail = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            })
          } else {
            repairComment(this.form).then(response => {
              if (response.code === 0) {
                this.msgSuccess("评价成功");
                this.openProcessing = false;
                this.openDetail = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            })
          }

        }
      })
    },
    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id !== undefined) {
            editRepair(this.form).then(response => {
              if (response.code === 0) {
                this.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            });
          } else {
            addRepair(this.form).then(response => {
              if (response.code === 0) {
                this.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDel(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除报修单编号为"' + ids + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        return delRepair(ids);
      }).then(() => {
        this.getList();
        this.msgSuccess("删除成功");
      }).catch(function () {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有报修单数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        return exportRepair(queryParams);
      }).then(response => {
        this.download(response.data);
      }).catch(function () {
      });
    }
  }
};
</script>
